<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #dd1{
            width: 500px;
            height: 500px;
            background-color: blue;
            text-align: center;
            /* margin: 10px auto; */
            position: relative;
        }   
    /* #dd2, #dd3, #dd4,#dd5 {
            width: 230px;
            height: 230px;
            background-color: yellow;
            margin: 10px;
            float: left; } *//* 添加浮动 */
        #dd2, #dd3, #dd4,#dd5 {
            width: 230px;
            height: 230px;
            background-color: yellow;
            margin: 10px;
            position:absolute;
        }
        #dd2{
            z-index: 1;
            background-color: red;
        }
        #dd3{
            z-index: 2;
            background-color: black;
            top: 20px;
            left: 20px;
        }
        #dd4{
            z-index: 3;
            background-color: green;
            top: 40px;
            left: 40px;
        }
        #dd5{
            z-index: 4;
            background-color: yellow;
            top: 60px;
            left: 60px;
        }
        
        </style>
</head>
<body>
    <div id="dd1">
        <div id="dd2">div1</div>
        <div id="dd3">div2</div>
        <div id="dd4">div3</div>
        <div id="dd5">div3</div>
    </div>
    
</body>
</html>